diff --git a/cups/gdevcups.c b/cups/gdevcups.c
index c00e758..35b4035 100644
--- a/cups/gdevcups.c
+++ b/cups/gdevcups.c
@@ -4353,10 +4353,10 @@ cups_set_color_info(gx_device *pdev)	/* I - Device info */
     */
 
     if (pdev->HWResolution[0] != pdev->HWResolution[1])
-      sprintf(resolution, "%.0fx%.0fdpi", pdev->HWResolution[0],
+      snprintf(resolution, sizeof(resolution), "%.0fx%.0fdpi", pdev->HWResolution[0],
               pdev->HWResolution[1]);
     else
-      sprintf(resolution, "%.0fdpi", pdev->HWResolution[0]);
+      snprintf(resolution, sizeof(resolution), "%.0fdpi", pdev->HWResolution[0]);
 
     for (i = 0, profile = cups->PPD->profiles;
          i < cups->PPD->num_profiles;
